package com.ssy.lingxi.transaction.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 商品询价-操作枚举类
 *
 * @author wrc
 * @date 2020/11/18
 */
public enum InquiryOperationEnum {

    ADD_INQUIRY(1, "新增询价单"),
    UPDATE_INQUIRY(2, "修改询价单"),
    SUBMIT_CHECK_INQUIRY(3, "提交审核询价单"),
    CHECK_INQUIRY_1(4, "单据审核(一级)"),
    CHECK_INQUIRY_2(5, "单据审核(二级)"),
    SUBMIT_INQUIRY(6, "提交询价单"),
    ;
    /**
     * 状态
     */
    private Integer state;


    /**
     * 描述
     */
    private String name;

    public static String getName(Integer state){
        InquiryOperationEnum workEnum = Arrays.stream(InquiryOperationEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(InquiryOperationEnum.class, workEnum.getState());
    }

    InquiryOperationEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

}
